<?php
abstract class Frontend_Controller{
	/**
	 * @var Page
	 */
	protected $_page;
	/**
     * Database connection
     * @var Zend_Db_Adapter_Abstract
     */
    protected $_db;
    /**
     * Application config
     * @var Config_Abstract
     */
    protected $_config;
    /**
     * Resources object
     * @var Resource
     */
    protected $_resource;
    /**
     * Dictionary
     * @var Lang
     */
    protected $_lang;
	
	public function __construct(){
		$this->_page = Page::getInstance();
		$this->_db = Application::getDbConnection();
		$this->_config = Application::getConfig();
		$this->_resource = Resource::getInstance();  
        $this->_lang = Lang::getInstance();
	}
	
	public function run()
	{
		$action = Request::getInstance()->getPath(1);
		if($action === false || !method_exists($this, $action.'Action'))
			$actionName = 'indexAction';
		else 
			$actionName = $action.'Action';
			
		$this->$actionName();
	}
	
	abstract function indexAction();
}